/**
 * Created by Administrator on 2018/4/12 0012.
 */
var bool=true;
$(window).load(function () {
    initEvent();
});

/**
 * 函数初始化
 */
function initEvent(){
    selfAdaption();
    removeTopElement();
}

/**
 *窗口发生改变
 */
window.onresize = function () {
    selfAdaption();
}

/**
 * 自适应rem
 */
function selfAdaption() {
    var screenWidth = document.documentElement.clientWidth;
    document.documentElement.style.fontSize = (100 / 640) * screenWidth + 'px';
}

/**
 * 移除顶层元素
 */
function removeTopElement() {
    $("section.fixed").remove();
}


//判断复选按钮span框是否被选中
$('.agreement .gou_bg').bind("touchstart", function () {
    if (bool) {
        $("#gouBg").css("background-image", "url('img/unchecked_box.png')");
        bool = false;
    } else {
        $("#gouBg").css("background-image", "url('img/checked_box.png')");
        bool = true;
    }
});


function onBridgeReady(){
    WeixinJSBridge.call('hideOptionMenu');
}



function checkweichatevent() {
    if (typeof WeixinJSBridge == "undefined"){
        if( document.addEventListener ){
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        }else if (document.attachEvent){
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    }else{
        onBridgeReady();
    }
}

function refulsh() {
    window.location.reload()
}
function  dorefulsh() {
    setTimeout("refulsh()", 1500);
}
function touchEvent(){
    $('body').on('touchmove', function (event) {
        event.preventDefault();
    });
}